{include file="public/header" /}
    <style>
        body {
            background-color: #ffffff;
        }
    </style>
</head>
<body>
<div class="layui-tab">
    <ul class="layui-tab-title">
        <li class="layui-this">
            <a target="_self" class="current" href="/admin/setting/system">
                网站设置
            </a>
        </li>
        <li>
            <a target="_self" class="current" href="/admin/setting/upload">
                存储配置
            </a>
        </li>
        <li>
            <a target="_self" class="current" href="/admin/setting/sms">
                短信配置
            </a>
        </li>
        <li>
            <a target="_self" class="current" href="/admin/setting/service">
                客服信息
            </a>
        </li>
    </ul>

</div>
<form class="layui-form" action="">
        <div class="layui-form-item">
            <label class="layui-form-label">产品简称</label>
            <div class="layui-input-block">
                <input type="text" name="product_name"  placeholder="请输入产品简称" class="layui-input" value="{$_info.product_name}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">网站简称</label>
            <div class="layui-input-block">
                <input type="text" name="site_name"  placeholder="请输入公司简称" class="layui-input" value="{$_info.site_name}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">网站关键词</label>
            <div class="layui-input-block">
                <input type="text" name="site_keyword"  placeholder="请输入网站关键词" class="layui-input" value="{$_info.site_keyword}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">网站描述</label>
            <div class="layui-input-block">
                <input type="text" name="site_description"  placeholder="请输入网站描述" class="layui-input" value="{$_info.site_description}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">站点标语</label>
            <div class="layui-input-block">
                <input type="text" name="site_slogan"  placeholder="请输入站点标语" class="layui-input" value="{$_info.site_slogan}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">IDC备案号</label>
            <div class="layui-input-block">
                <input type="text" name="idc_num"  placeholder="请输入IDC备案号" class="layui-input" value="{$_info.idc_num}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">文网文备案号</label>
            <div class="layui-input-block">
                <input type="text" name="nc_num"  placeholder="请输入文网文备案号" class="layui-input" value="{$_info.nc_num}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">文网文授权链接</label>
            <div class="layui-input-block">
                <input type="text" name="nc_link"  placeholder="请输入文网文授权链接" class="layui-input" value="{$_info.nc_link}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">网安备案号</label>
            <div class="layui-input-block">
                <input type="text" name="netc_num"  placeholder="请输入网安备案号" class="layui-input" value="{$_info.netc_num}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">站点开关</label>
            <div class="layui-input-block">
                <input type="checkbox" name="site_open" lay-skin="switch" lay-filter="switchTest1" lay-text="ON|OFF" {eq name="$_info.site_open" value="1"} checked="" {/eq}>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">广告开关</label>
            <div class="layui-input-block">
                <input type="checkbox" {eq name="$_info.ad_open" value="1"} checked="" {/eq} name="ad_open" lay-skin="switch" lay-filter="switchTest" lay-text="ON|OFF">
            </div>
        </div>

        <div class="layui-form-item">
            <div class="layui-input-block">
                <button type="submit" class="layui-btn" lay-submit lay-filter="saveBtn">立即提交</button>
            </div>
        </div>
</form>
</body>
{include file="public/footer" /}
<script>
    layui.use(['form'], function () {
        var form = layui.form,
            layer = layui.layer,
            $ = layui.$;

        //监听提交
        form.on('submit(saveBtn)', function (data) {
            if(data.field.site_open == "on") {
                data.field.site_open = "1";
            } else {
                data.field.site_open = "0";
            }
            if(data.field.ad_open == "on") {
                data.field.ad_open = "1";
            } else {
                data.field.ad_open = "0";
            }

            $.ajax({
                url: "{:url('system')}",
                type: 'post',
                dataType: 'json',
                contentType: 'application/json',
                data: JSON.stringify(data.field),
                timeout: 2000,
                success: function (data1) {
                    if (data1.code == 0) {
                        layer.msg(data1.msg)
                        setTimeout(function () {
                            var iframeIndex = parent.layer.getFrameIndex(window.name);
                            parent.layer.close(iframeIndex);
                        }, 1000);
                    } else {
                        layer.msg(data1.msg)
                    }
                },
                error: function () {
                    layer.msg("添加失败")
                }
            })
            return false;
        });

    });
</script>
</html>
